package com.cskaoyan.service;

import com.cskaoyan.bean.User;
import com.cskaoyan.bean.UserData;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.mapper.UserMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public UserData query(BaseParam param, String username) {
        // 进行分页查询，需要传入页号和页大小
        PageHelper.startPage(param.getPage(), param.getLimit());
        List<User> users = userMapper.select(param.getSort(), param.getOrder(), username);
        // 获得一些分页信息，上面的查询对应的PageInfo，把原始查询结果放到PageInfo的构造方法中即可
        // total表示总的信息数量->代表不分页的情况下，按照查询条件，能查出来多少条user数据
        return null;
    }
}
